package com.justnow.offer;

/**
 * @author justnow
 * Created on 2020-08-12
 * Description
 */
public class Solution24 {

    public ListNode reverseList(ListNode head) {
        ListNode cur = null, pre = head;
        while (pre != null) {
            ListNode tmp = pre.next;
            pre.next = cur;
            cur = pre;
            pre = tmp;
        }
        return cur;
    }
}

class ListNode {
    int val;
    ListNode next;
    public ListNode (int val) {
        this.val= val;
    }
}
